package com.mybatis.dao.impl;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import com.mybatis.dao.IUserDao;
import com.mybatis.dao.model.User;

public class UserDaoImpl implements IUserDao {
    @Override
    public List<User> selects() throws IOException {
        InputStream resourceAsStream = Resources.getResourceAsStream("sqlMapConfig.xml");
        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(resourceAsStream);
        SqlSession sqlSession = sqlSessionFactory.openSession();
        return sqlSession.selectList("user.selects");
    }

    @Override
    public List<User> selectByCondition(User user) {
        return null;
    }

    @Override
    public List<User> selectByIds(int[] ids) {
        return null;
    }
}
